﻿using System;
using System.Windows;
using System.Windows.Controls;
//using SomethingSpacialClassLib.Web;
using SomethingSpacial.ViewModel;
using SomethingSpacial.Web;


namespace SomethingSpacial.Views.Admin
{
    public partial class EventList : Page
    {

        SomethingSpacialContext domainContext = new SomethingSpacialContext();

        public EventList()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(EventList_Loaded);
        }

        #region "Page Events"

        void EventList_Loaded(object sender, RoutedEventArgs e)
        {
           ((EventsViewModel)this.DataContext).loadEvents();
            
        }


        private void SubmitButton_Click(object sender, RoutedEventArgs e)
        {
            editDataForm.CommitEdit();
        }

        private void AddNew_Click(object sender, RoutedEventArgs e)
        {
            var w = new EventAdd();
            w.Closed += addNewWindow_Closed;
            w.Show();
        }

        void addNewWindow_Closed(object sender, EventArgs e)
        {

            EventAdd addForm = (EventAdd)sender;
            if (addForm.NewEvent != null)
            {
              //  ((EventsViewModel)this.DataContext).addEvent(addForm.NewEvent);
            }

        }

        private void gridEvents_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {

        }

        #endregion











    }
}
